{include file="header.html"}
<div class="page-header">
	<h6>
		订单管理
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			订单详情
		</small>
	</h6>
</div>

<div class="row col-group">
	<div class="col-xs-12">
		<form class="form-horizontal" role="form" method="post" action="?app=order&act=edit" enctype="multipart/form-data" id="form">
		<input type="hidden" id="id" name="id" value="{$row->id}" />
		<input type="hidden" id="oldstatus" name="oldstatus" value="{$row->status}" />
		<input type="hidden" id="readed" name="readed" value="{$row->readed}" />
		<input type="hidden" name="print" id="print" value="" />
		
		<div class="form-group">
			<h4 class="col-sm-2 control-label no-padding-right"> 会员信息 </h4>
			<div class="col-sm-10">
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 下单人 </label>
					<div class="col-sm-10">
						<h5><a href="?app=member&act=edit&id={$row->member_id}" target="_blank">{$row->member_name}</a></h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 下单人电话 </label>
					<div class="col-sm-10">
						<h5>{$row->mobile}</h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 下单时间 </label>
					<div class="col-sm-10">
						<h5>{date('Y-m-d H:i:s', $row->add_time)}</h5>
					</div>
				</div>
			</div>
		</div>
		
		<div class="form-group">
			<h4 class="col-sm-2 control-label no-padding-right"> 订单信息 </h4>
			<div class="col-sm-10">
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 订单ID </label>
					<div class="col-sm-10">
						<h5>{$row->id}</h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 订单号 </label>
					<div class="col-sm-10">
						<h5>{$row->order_sn}</h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 支付方式 </label>
					<div class="col-sm-10">
						<h5>{if $row->pay_method == 'wxpay'}APP内微信支付
						{else if $row->pay_method == 'wxpay_h5'}服务号内支付
						{else if $row->pay_method == 'alipay'}支付宝支付
						{else if $row->pay_method == 'yue'}余额支付
						{else if $row->pay_method == 'integral'}积分兑换{/if}</h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 支付时间 </label>
					<div class="col-sm-10">
						<h5>{if $row->pay_time}{date('Y-m-d H:i:s', $row->pay_time)}{else}-{/if}</h5>
					</div>
				</div>
				<!--<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="shipping_company"> 快递公司 </label>
					<div class="col-sm-10">
						<input type="text" name="shipping_company" id="shipping_company" value="{$row->shipping_company}" class="col-xs-4" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="shipping_number"> 快递单号 </label>
					<div class="col-sm-10">
						<input type="text" name="shipping_number" id="shipping_number" value="{$row->shipping_number}" class="col-xs-4" />
					</div>
				</div>-->
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="status"> 状态 </label>
					<div class="col-sm-10">
						<select name="status" id="status">
						{if $row->status >= 0}
							<option value="">请选择</option>
							<option value="0" {if $row->status==0}selected{/if}>未支付</option>
							{if $row->status != 0}
								<option value="1" {if $row->status==1}selected{/if}>已支付</option>
								<option value="2" {if $row->status==2}selected{/if}>已完成</option>
							{/if}
							<option value="-1" {if $row->status==-1}selected{/if}>已取消</option>
						{else if $row->status==-1}
							<option value="-1" selected >已取消</option>
						{/if}
						</select>
						<input type="hidden" name="origin_status" id="origin_status" value="{$row->status}" />
						{if $row->ask_refund_time>0}<span class="some-line" style="color:#f00;">买家提交了申请退货/款</span>{/if}
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="total_price"> {if $row->integral_order==1}订单总积分{else}订单总价{/if} </label>
					<div class="col-sm-10">
						<input type="text" name="total_price" id="total_price" value="{if $row->integral_order==1}{intval($row->total_price)}{else}{$row->total_price}{/if}" class="col-xs-3" />
						<span class="some-line">{if $row->integral_order==1}积分{else}元{/if}</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="used_coupon"> 优惠卷抵扣 </label>
					<div class="col-sm-10">
						<input type="text" name="used_coupon" id="used_coupon" value="{$row->used_coupon}" class="col-xs-3" />
						<span class="some-line">元</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="gjj_total"> 公积金费用 </label>
					<div class="col-sm-10">
						<input type="text" name="gjj_total" id="gjj_total" value="{$row->gjj_total}" class="col-xs-3" />
						<span class="some-line">元</span>
					</div>
				</div>
				<!--<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="gjj_total"> 公积金总价 </label>
					<div class="col-sm-10">
						<h5>{$row->gjj_total}元</h5>
					</div>
				</div>-->
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="service_money"> 服务费单价 </label>
					<div class="col-sm-10">
						<input type="text" name="service_money" id="service_money" value="{$row->service_money}" class="col-xs-3" />
						<span class="some-line">元</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="service_money_total"> 服务费总价 </label>
					<div class="col-sm-10">
						<input type="text" name="service_money_total" id="service_money_total" value="{$row->service_money_total}" class="col-xs-3" />
						<span class="some-line">元</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="differ_money"> 需补差价 </label>
					<div class="col-sm-10">
						<input type="text" name="differ_money" id="differ_money" value="{$row->differ_money}" class="col-xs-3" />
						<span class="some-line">元　不需补差价请设为0</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="differ_pay_time"> 差价支付状态 </label>
					<div class="col-sm-10">
						<h5>
							{if $row->differ_pay_time>0}<font color="orange">已支付</font> ({date('Y-m-d H:i:s', $row->differ_pay_time)})
							{else if $row->differ_money>0}<font color="red">未支付</font>
							{else}-{/if}
						</h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="remark"> 备注 </label>
					<div class="col-sm-10">
						<textarea style="width: 500px;height: 100px;text-align: left;" name="remark" rows="3"id="remark">{if $row->remark}{$row->remark}{/if}</textarea>
					</div>
				</div>
				<div class="col-ra">
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 姓名 </label>
						<div class="col-sm-10">
							<h5>{$info.name}</h5>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 身份证号 </label>
						<div class="col-sm-10">
							<h5>{$info.idcard}</h5>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 身份证图片 </label>
						<div class="col-sm-10">
							<h5><a href="{$info.idcard_pic1}" target="_blank"><img src="{$info.idcard_pic1}" height="50"></a>
							<a href="{$info.idcard_pic2}" target="_blank"><img src="{$info.idcard_pic2}" height="50"></a></h5>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 手机号 </label>
						<div class="col-sm-10">
							<h5>{$info.mobile}</h5>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 户口性质 </label>
						<div class="col-sm-10">
							<h5>{$info.type}</h5>
						</div>
					</div>
				</div>
				<div class="col-ra">
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 参保城市 </label>
						<div class="col-sm-10">
							<select name="province" id="province"></select>
							<span class="some-line"></span>
							<select name="city" id="city"></select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 参保方案 </label>
						<div class="col-sm-10">
							<select name="casy_id" id="casy_id"></select>
						</div>
					</div>
				</div>
				<div class="col-ra">
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 缴费年月 </label>
						<div class="col-sm-10">
							<h5>{$info.month}</h5>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 社保费用 </label>
						<div class="col-sm-10">
							<h5>{$info.total}元</h5>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 公积金费用 </label>
						<div class="col-sm-10">
							<h5>{$row->gjj_total}元</h5>
						</div>
					</div>
				</div>
				<!--<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="shipping_price"> 运费 </label>
					<div class="col-sm-10">
						<input type="text" name="shipping_price" id="shipping_price" value="{$row->shipping_price}" class="col-xs-3" />
						<span class="some-line">元</span>
					</div>
				</div>
				<div class="col-ra">
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 余额支付了 </label>
						<div class="col-sm-10">
							<h5>{$row->used_money}元</h5>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 佣金支付了 </label>
						<div class="col-sm-10">
							<h5>{$row->used_commission}元</h5>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right" for=""> 优惠券支付了 </label>
						<div class="col-sm-10">
							<h5>{$row->used_coupon}元
							{if $row->coupon_sn}<span style="margin-left:30px;">
							优惠券编号 <a href="?app=coupon&act=edit&id={$row->coupon_id}" target="_blank">{$row->coupon_sn}</a></span>{/if}
							</h5>
						</div>
					</div>
				</div>-->
			</div>
		</div>
		<!--
		<div class="form-group no-border">
			<h4 class="col-sm-2 control-label no-padding-right"> 商品列表 </h4>
			<div class="col-sm-10">
				{foreach from=$goods key=k item=g}
				<div>
				<input type="hidden" name="goods[]" id="goods{$k}" value="{$g->id}" />
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 商品图片 </label>
					<div class="col-sm-10">
						<h5><a href="{$g->goods_pic}" target="_blank"><img src="{if $g->goods_pic!==''}{$g->goods_pic}{else}/images/nopic.png{/if}" style="width:100px;" /></a></h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 商品名称 </label>
					<div class="col-sm-10">
						<h5><a href="?app=goods&act=edit&id={$g->goods_id}" target="_blank">{$g->goods_name}</a></h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 商品规格 </label>
					<div class="col-sm-10">
						<h5>{$g->spec}</h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="price"> {if $row->integral_order==1}商品积分{else}商品单价{/if} </label>
					<div class="col-sm-10">
						<input type="text" name="price[]" id="price{$k}" value="{if $row->integral_order==1}{intval($g->price)}{else}{$g->price}{/if}" class="col-xs-3 price" onchange="onCh()" />
						<span class="some-line">{if $row->integral_order==1}积分{else}元{/if}</span>
						<input type="hidden" name="" value="{$g->quantity}" class="quantity" />
						<input type="hidden" name="" value="{$g->price}" class="tol" />
						<div style="float:left;margin-left:30px;line-height:34px;">购买数量<span style="color:#999;margin-left:12px;">{$g->quantity}</span></div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 商家 </label>
					<div class="col-sm-10">
						<h5><a href="?app=shop&act=edit&id={$g->shop_id}" target="_blank">{$g->shop_name}</a></h5>
					</div>
				</div>
				{if $g->comment_time>0}
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for=""> 评价星级 </label>
					<div class="col-sm-10">
						<h5>{if $g->comment_content}{$g->comment_stars}星　　评论时间：{date('Y-m-d H:i:s', $g->comment_time)} {/if}</h5>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right" for="comment_content"> 评价内容 </label>
					<div class="col-sm-10">
						<textarea name="comment_content" id="comment_content" style="width:100%;height:80px;" disabled>{$g->comment_content}</textarea>
					</div>
				</div>
				{/if}
				</div>
				{/foreach}
			</div>
		</div>
		-->
		<div class="clearfix form-actions">
			<div class="col-md-offset-3 col-md-9">
				<button class="btn btn-info" type="submit">
					<i class="ace-icon fa fa-check bigger-110"></i>
					提交
				</button>
	
				&nbsp; &nbsp; &nbsp;
				<button class="btn" type="reset">
					<i class="ace-icon fa fa-undo bigger-110"></i>
					重置
				</button>
	
				&nbsp; &nbsp; &nbsp;
				<button class="btn btn-info" type="button" onclick="javascript:history.go(-1)">
					<i class="ace-icon fa fa-check bigger-110"></i>
					返回
				</button>
				<!--&nbsp; &nbsp; &nbsp;
				<button class="btn" id="sub" style="{if $row->status<=0}display:none;{/if}">
					<i class="ace-icon fa fa-print bigger-120"></i>
					打印发货单
				</button>-->
			</div>
		</div>
		</form>
	</div>
</div>

{include file="footer.html"}
<script>
var casy_id = '{$row->casy_id}';
function add(){
	var total = 0;
	$('.tol').each(function(){
		total += parseFloat($(this).val());
	});
	$('#total_price').val(total);
}
$(function(){
	defaultText = '';
	showCity({ province:'#province', city:'#city', provincecode:'{$row->province}', citycode:'{$row->city}' });
	$('#city').change(function(){
		$.getJSON('?app=order&act=get_casy&city_id='+$(this).selected().val(), function(json){
			var html = '';
			$.each(json.data, function(){
				html += '<option value="'+this.id+'" '+(this.id==casy_id?'selected':'')+'>'+this.name+'</option>';
			});
			if(!html.length)html = '<option value="">没有参保方案</option>';
			$('#casy_id').html(html);
		});
	});
	$(".price").blur(function(){
		var total = $(this).val() * $(this).siblings('.quantity').val();
		$(this).siblings('.tol').val(total);
		add();
	});
	$('#sub').click(function(){
		$('#print').val('1');
		$('#form').submit();
	});
	$('#status').click(function(){
		var x = $(this).val();
		if(x > 0){
			$('#sub').show();
		}else{
			$('#sub').hide();
		}
	});
});
</script>
